package cloud.xlh.event_pub_and_listen.publisher;

import lombok.RequiredArgsConstructor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationEvent;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 *
 * @ project name : xlh_osms
 * @ Author: XuLeHuang
 * @ Date: 2023/8/6 9:28
 * @ Description:
 */
@Component
@RequiredArgsConstructor
public class EventPublisher {
    /** 注入ApplicationContext用来发布事件 */
    private final ApplicationContext applicationContext;

    public void publishEvent(ApplicationEvent applicationEvent) {
        applicationContext.publishEvent(applicationEvent);
    }
}
